import { http } from "@/utils/http";
import { Result, arrayResult } from "../types";

type data = {
  agvid?: number,
  agvname?: string,
  ip?: string,
  model?: string,
  status?: number,
  vehicletype?: number,
  note?: string
};

type search = {
  roadname: string,
  dateRange: Array<any>,
  begin: string,
  end: string,
  pageNumber: number,
  pageSize: number,
  sortName: string,
  sortType: number
}

// 路段列表
export const RoadList = (params) => {
  return http.request<Result>("get", "/api/road/List", { params });
};

// 新增路段
export const addRoad = (data: data) => {
  return http.request<Result>("post", "/api/road/Add", { data });
};

// 修改路段
export const updateRoad = (data: data) => {
  return http.request<Result>("post", "/api/road/Update", { data });
};

// 删除路段
export const delRoad = (id: number) => {
  return http.request<Result>("post", `/api/road/Delete/${id}`, {});
};

// 查询速度等级类型下拉
export const SpeedLevel = () => {
  return http.request<arrayResult>("get", "/api/Dict/ListByParentCode/SpeedLevel", {});
};

// 详情
export const getRoad = (id?: number) => {
  return http.request<Result>("get", `/api/road/Get/${id}`, {});
};

// 总图所有路段信息
export const GetAllRoad = (params?:any) => {
  return http.request<Result>("get", `/api/road/GetAllRoad`, {params});
};
